Skip to content

BREAKING: Restrict Custom identifiers to c / cN and add OptableVID - #63

Open
jrosendahl-opt wants to merge 1 commit into
masterfrom
feat/custom-identifier-index
Open

jrosendahl-opt wants to merge 1 commit into
masterfrom
feat/custom-identifier-index

Conversation

@jrosendahl-opt

Copy link
Copy Markdown
Contributor

Why

OptableIdentifier.Custom(key, value) sent key:value for any key. The iOS SDK only allows the custom types c and c1…cN (case custom(Int? = nil, String)), with the Optable visitor ID as its own optableVID case, and that behaviour was confirmed as the correct one. This brings Android in line.

What Changed

  • android_sdk: breaking Custom(key: String, value) is replaced by Custom(index: Int?, value) and Custom(value). A null or 0 index is sent as c, any other as c<abs(index)>, matching iOS. The value is trimmed, as before.
  • android_sdk: new OptableIdentifier.OptableVID(value) for the Optable visitor ID, previously Custom("v", value). Sent as v, whitespace removed, as before.
  • android_sdk: IdentifiersEncoder builds the c / cN prefix from the index; no other prefix can come from Custom. Raw is unchanged.
  • android_sdk tests: moved to the new API, plus a test for no index, null, 0 and a negative index.
  • README: identifier and hids examples use OptableVID, Custom(value) and Custom(index, value).

How to Test

  • ./gradlew test passes (161 tests locally)
  • Verified in DemoAppJava / DemoAppKotlin (the demos don't use Custom)
  • README updated (if public API changed)

Notes

Do not merge before v1.3.0 is tagged, or the break ships in 1.3.0. This is for 2.0.0: optableVersionName in gradle.properties needs bumping to 2.0.0 (separately, as #52 did for 1.3.0).

Migration: Custom("v", x) → OptableVID(x); Custom("c", x) → Custom(x); Custom("cN", x) → Custom(N, x). Any other key is no longer supported; use Raw("type:value") if it is really needed.

After this merges, #60's identifier table needs its Custom row updated and an OptableVID row added.

  • Breaking change
  • Requires release

🤖 Generated with Claude Code

OptableIdentifier.Custom took any key and sent "key:value". Match the iOS
SDK, which only allows the custom types "c" and "c1".."cN":

- Custom(key: String, value) is replaced by Custom(index: Int?, value)
  and Custom(value). A null or 0 index is sent as "c", any other as
  "c<abs(index)>". The value is trimmed, as before.
- The Optable visitor ID, previously Custom("v", value), is now
  OptableVID(value), sent as "v" with whitespace removed.

Existing Custom(key, value) calls no longer compile, so this is for 2.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant